/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.*;


/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class AdityaZadgaonkarMBD extends IterativeRobot {

    Solenoid left1;
    Solenoid right1;
    Solenoid left2;
    Compressor comp;
    Joystick leftJoy;
    Joystick rightJoy;
    Jaguar forkmotor1;
    Jaguar forkmotor2;

    public void robotInit() {
     left1 = new Solenoid(1);
     left2= new Solenoid(2);
     right1 = new Solenoid(3);
     comp = new Compressor(3,4);
     leftJoy = new Joystick(1);
     rightJoy = new Joystick(2);
     forkmotor1 = new Jaguar(5);
     forkmotor2 = new Jaguar(6);
    }

    public void autonomousPeriodic() {

    }

    
    public void teleopPeriodic() {
      comp.setRelayValue(Relay.Value.kOn);
      boolean deployValues[] = {true,true};
      boolean joyGetValues[] = {leftJoy.getTrigger(), rightJoy.getTrigger()};
      if ( joyGetValues == deployValues){
          left1.set(true);
          right1.set(true);
          Timer.delay(.75);
          left1.set(false);
          right1.set(false);
          left2.set(true);
      }
      double speed = ((leftJoy.getThrottle() - 50)*2)/100;
      if (speed >= 5 || speed <=5){
          speed = 0;
      }
      forkmotor1.set(speed);
      forkmotor2.set(speed);
    }
}
